package com.meedoll.manager.std.client.mainpanel.composites;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.MenuItemSeparator;
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.layout.VStack;
import com.smartgwt.client.widgets.tile.TileGrid;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.WidgetCanvas;
import com.google.gwt.user.client.ui.Label;

public class MainPanelUI extends Composite {

	public MainPanelUI() {
		FlexTable flexTable_content = new FlexTable();
		VLayout layout = new VLayout();
		layout.setSize("98%", "100%");
		
		com.google.gwt.user.client.ui.MenuBar menuBar = new com.google.gwt.user.client.ui.MenuBar(false);
		menuBar.setHeight("29px");
		layout.addMember(menuBar);
		
		MenuItem menuItem = new MenuItem("New item", false, (Command) null);
		menuBar.addItem(menuItem);
		
		MenuItemSeparator separator = new MenuItemSeparator();
		menuBar.addSeparator(separator);
		
		MenuItem menuItem_1 = new MenuItem("New item", false, (Command) null);
		menuBar.addItem(menuItem_1);
		
		HLayout hLayout = new HLayout();
		hLayout.setSize("100%", "100%");
		
		VStack vStack = new VStack();
		vStack.setWidth("138px");
		
		Canvas canvas = new Canvas();
		canvas.setSize("100%", "100%");
		
		TileGrid tileGrid = new TileGrid();
		canvas.addChild(tileGrid);
		tileGrid.moveTo(1, 0);
		tileGrid.setSize("100%", "100%");
		
		Button button = new Button("New Button");
	
		canvas.addChild(button);
		button.setRect(20, 40, 100, 30);
		
		Button button_2 = new Button("New Button");

		canvas.addChild(button_2);
		button_2.setRect(20, 340, 100, 30);
		
		Button button_1 = new Button("New Button");
		canvas.addChild(button_1);
		button_1.setRect(20, 140, 100, 30);
		
		Button button_3 = new Button("New Button");
		canvas.addChild(button_3);
		button_3.setRect(20, 240, 100, 30);
		
		Button button_4 = new Button("New Button");
		canvas.addChild(button_4);
		button_4.setRect(20, 440, 100, 30);
		vStack.addMember(canvas);
		hLayout.addMember(vStack);
		
		final Canvas canvas_1 = new Canvas();
		canvas_1.setSize("100%", "100%");
		
		TileGrid main_tileGrid_panel = new TileGrid();
		canvas_1.addChild(main_tileGrid_panel);
		main_tileGrid_panel.moveTo(0, 0);
		main_tileGrid_panel.setSize("100%", "100%");
		
		final FlexTable flexTable = new FlexTable();
		WidgetCanvas widgetCanvas = new WidgetCanvas(flexTable);
		flexTable.setSize("100%", "100%");
		canvas_1.addChild(widgetCanvas);
		widgetCanvas.setRect(0, 0, 100, 100);
		
		//canvas_1.addChild(new XiaoShouManagerComposite2(new FlexTable()));
		button.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {

				flexTable.clear();
				flexTable.setWidget(0,0,new XiaoShouManagerComposite(new FlexTable()));
				
				//
				//canvas_1.addChild(new XiaoShouManagerComposite2(new FlexTable()));
			
			}
		});
		
		button_2.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {

				flexTable.clear();
				flexTable.setWidget(0,0,new JinHuoManagerComposite(new FlexTable()));
			}
		});
		hLayout.addMember(canvas_1);
		layout.addMember(hLayout);
		initWidget(layout);
	}
}
